import logging


# only to log what I do, not errors
class MyLogger:

    def __init__(self, logPath='log/log.txt'):
        logger = logging.getLogger(__name__)
        logger.setLevel(logging.INFO)

        # add FileHandler to log to file
        fileHandler = logging.FileHandler(logPath)
        fileHandler.setLevel(logging.INFO)
        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
        fileHandler.setFormatter(formatter)
        logger.addHandler(fileHandler)

        # add StreamHandler to log to console
        consoleHandler = logging.StreamHandler()
        consoleHandler.setLevel(logging.INFO)
        logger.addHandler(consoleHandler)

        self.logger = logger
